from typing import List, Optional
from pydantic import BaseModel, Field
from .base import BaseSchema
from .permission import PermissionSchema

class RoleBase(BaseSchema):
    """角色基础模型"""
    name: str = Field(..., max_length=50, description="角色名称")
    description: Optional[str] = Field(None, max_length=255, description="角色描述")
    level: Optional[int] = Field(0, description="角色级别: 0-自定义, 100-审计员, 200-观测员, 300-飞手, 400-任务管理员, 500-超级管理员")

class RoleCreate(RoleBase):
    """创建角色模型"""
    permission_ids: Optional[List[int]] = Field(None, description="权限ID列表")

class RoleUpdate(RoleBase):
    """更新角色模型"""
    permission_ids: Optional[List[int]] = Field(None, description="权限ID列表")

class RoleSchema(RoleBase):
    """角色响应模型"""
    permissions: List[PermissionSchema] = Field([], description="权限列表")